package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.common.util.AuthContextHolder;
import com.atguigu.gmall.product.client.ProductFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author mqx
 * @date 2020-12-8 15:49:05
 */
@Controller
public class IndexController {

    @Autowired
    private ProductFeignClient productFeignClient;

    //  写控制器 /,index.html
    @RequestMapping("index.html")
    public String index(Model model){
        //  后台存储一个list
        Result result = productFeignClient.getBaseCategoryList();
        model.addAttribute("list",result.getData());
        //  返回页面
        return "index/index";
    }

    @RequestMapping("/")
    public String index1(Model model){
        Result result = productFeignClient.getBaseCategoryList();
        model.addAttribute("list",result.getData());
        return "index/index";
    }

}
